﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace _0712502_0712504_DesignPatternGame
{
    public class GameDisplayDrawer
    {
        Texture2D enemyTankIcon;
        Texture2D playerTankIcon;
        Texture2D playerBulletIcon;
        int iPlayerTankLife = 3;
        public GameDisplayDrawer()
        {
          //  this.enemyTankIcon = GameResourceContainer.ImageManager.enemyTankIcon;
         //   this.playerBulletIcon = GameResourceContainer.ImageManager.playerTankIcon;
          //  this.playerBulletIcon = GameResourceContainer.ImageManager.tankBulletIcons[0];
        }

        public void Initilize()
        {
            this.enemyTankIcon = GameResourceContainer.ImageManager.enemyTankIcon;
            this.playerTankIcon = GameResourceContainer.ImageManager.playerTankIcon;
            this.playerBulletIcon = GameResourceContainer.ImageManager.tankBulletIcons[0];
        }
        public void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
            //Sprite Icon cua enemy tank va so luong enemy tank
            spriteBatch.Draw(enemyTankIcon, new Vector2(880,20), Color.White);
            spriteBatch.Draw(playerBulletIcon, new Vector2(100, 250), Color.White);
            spriteBatch.DrawString(GameResourceContainer.FontManager.ArialFont,GlobalVariables.numOfEnemyTank.ToString(), new Vector2(930, 20), Color.White);

            spriteBatch.DrawString(GameResourceContainer.FontManager.ArialFont, GlobalVariables.playerEXP.ToString(), new Vector2(930, 700), Color.White);

            spriteBatch.DrawString(GameResourceContainer.FontManager.ArialFont, 
                        GlobalVariables.playerCurHP.ToString() +" / "+GlobalVariables.playerMaxHP.ToString(), 
                                                                    new Vector2(630, 700), Color.White);

            spriteBatch.DrawString(GameResourceContainer.FontManager.ArialFont, GlobalVariables.playerLife.ToString(), new Vector2(330, 700), Color.White);
            DrawPlayerTankLife(spriteBatch);
        }

        public void DrawPlayerTankLife(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < iPlayerTankLife; i++)
            {
                spriteBatch.Draw(playerTankIcon, new Vector2(100 + i * 42, 100), Color.Green);
            }
        }
    }
}
